<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>创建项目</title>
<link rel="stylesheet" href="js/layui/css/layui.css" />
<script src="js/layui/layui.js" type="text/javascript">
	
</script>
</head>
<body>
	<!--表单的创建-->
	<form class="layui-form" id="adduserfm" action="">
		<div class="layui-form-item">
			<label class="layui-form-label">项目编号</label>
			<div class="layui-input-inline">
				<input type="text" id="projectNo" name="projectNo"
					lay-verify="required" placeholder="" autocomplete="on"
					class="layui-input">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">项目名</label>
			<div class="layui-input-inline">
				<input type="text" id="projectName" name="projectName"
					lay-verify="required" placeholder="" autocomplete="on"
					class="layui-input">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">版本号</label>
			<div class="layui-input-inline">
				<input type="text" id="projectVersion" name="projectVersion"
					lay-verify="required" placeholder="" autocomplete="on"
					class="layui-input">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">仓库地址</label>
			<div class="layui-input-inline">
				<input type="text" id="gitUrl" name="gitUrl" lay-verify="required"
					placeholder="" autocomplete="on" class="layui-input">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">Pom文件路径</label>
			<div class="layui-input-inline">
				<input type="text" id="gitPath" name="gitPath" lay-verify="required"
					placeholder="" autocomplete="on" class="layui-input">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">部署机器</label>
			<div class="layui-input-inline">
				<input type="text" id="serverName" name="serverName"
					lay-verify="required" placeholder="" autocomplete="on"
					class="layui-input">
			</div>
		</div>


		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>

	<script>
		var server_url = "..";

		layui.use([ 'form', 'jquery', 'layer' ], function() {
			var form = layui.form, layer = layui.layer, $ = layui.$
			var fm = $('#adduserfm').serialize();
			//监听提交
			form.on('submit(demo1)', function(data) {
				/*layer.alert(JSON.stringify(data.field), {
				  title: '最终的提交信息'
				})*/

				$.ajax({
					type : "get",
					url : server_url + '/save',
					data : {
						projectName : $('#projectName').val(),
						projectVersion : $('#projectVersion').val(),
						gitPath : $('#gitPath').val(),
						gitUrl : $('#gitUrl').val(),
						projectNo : $('#projectNo').val(),
						serverName : $('#serverName').val()
					},
					// dataType:'json',
					success : function(res) {
						
						
						if (res) {
							layer.msg('添加成功');
							parent.layer.closeAll('iframe'); //关闭所有的iframe层
							parent.location.reload();
						} else {
							layer.msg('添加失败')
						}
					}
				});
				return false;
			});

		});
	</script>



</body>
</html>
